local sk__jueyong = fk.CreateSkill {

  name = "sk__jueyong",

  tags = { Skill.Limited, },

}



sk__jueyong:addEffect(fk.Damage, {
  name = "sk__jueyong",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(sk__jueyong.name) and target and target == player and data.card and data.card.trueName == "slash" and
      player:getHandcardNum() > player.maxHp and player:usedSkillTimes(sk__jueyong.name, Player.HistoryGame) == 0
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__jueyong.name, nil, "#sk__jueyong-invoke")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = player:getHandcardNum() - player.maxHp
    room:changeMaxHp(player, n)
    if not player.dead and player:isWounded() then
      room:recover({
        who = player,
        num = player:getLostHp(),
        recoverBy = player,
        skillName = sk__jueyong.name,
      })
    end
  end,
})

return sk__jueyong